<template>
  <div class="home">
    <el-container>
      <el-header>
        <h1>文件历史版本管理工具</h1>
      </el-header>
      <el-main>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-card class="feature-card" @click="$router.push('/history')">
              <template #header>
                <el-icon><FolderOpened /></el-icon>
                <span>版本浏览</span>
              </template>
              <p>浏览所有历史版本和文件结构</p>
            </el-card>
          </el-col>
          <el-col :span="6">
            <el-card class="feature-card" @click="$router.push('/search')">
              <template #header>
                <el-icon><Search /></el-icon>
                <span>搜索文件</span>
              </template>
              <p>按文件名或内容搜索历史记录</p>
            </el-card>
          </el-col>
          <el-col :span="6">
            <el-card class="feature-card" @click="$router.push('/diff')">
              <template #header>
                <el-icon><DocumentCopy /></el-icon>
                <span>差异对比</span>
              </template>
              <p>比较文件在不同版本间的差异</p>
            </el-card>
          </el-col>
          <el-col :span="6">
            <el-card class="feature-card" @click="$router.push('/recovery')">
              <template #header>
                <el-icon><Download /></el-icon>
                <span>文件恢复</span>
              </template>
              <p>恢复历史版本中的文件到目标位置</p>
            </el-card>
          </el-col>
        </el-row>
      </el-main>
    </el-container>
  </div>
</template>

<script setup lang="ts">
  import { FolderOpened, Search, DocumentCopy, Download } from '@element-plus/icons-vue'
</script>

<style scoped>
  .home {
    height: 100vh;
  }

  .el-header {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--el-color-primary);
    color: white;
  }

  .el-main {
    padding: 40px;
  }

  .feature-card {
    cursor: pointer;
    transition: all 0.3s;
    height: 150px;
  }

  .feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }

  .feature-card .el-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
  }

  .feature-card .el-icon {
    font-size: 20px;
  }
</style>